package com.difsonapps.android.marker.dialogs;

import com.difsonapps.android.marker.MainActivity;
import com.difsonapps.android.marker.R;

import android.app.Dialog;
import android.view.View;


public class MenuAddPhotoDialog extends Dialog{
	MainActivity activity;
	
	
	public MenuAddPhotoDialog(MainActivity activity) {
		super(activity, R.style.mydialogstyle);
		this.activity = activity;
		setTitle(R.string.upload_photo_from);
		
		setContentView(R.layout.dialog_menu_add_photo);
		findViewById(R.id.gallery_button).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				addFromGallery();
			}
		});
		findViewById(R.id.camera_button).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				addFromCamera();
			}
		});
		findViewById(R.id.cancel_button).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				cancelAction();
			}
		});
	}
	
	private void addFromGallery(){
		activity.addPhotos(false);
		dismiss();
	}
	
	private void addFromCamera(){
		dismiss();
		activity.addPhotos(true);
	}
	
	private void cancelAction(){
		dismiss();
	}

}
